IF EXISTS (SELECT *
           FROM   INFORMATION_SCHEMA.ROUTINES 
           WHERE  routine_name = 'sp_WeeklyArticle'
           AND    routine_type = 'Procedure'
           AND    routine_schema = 'dbo' )
BEGIN
   DROP PROCEDURE dbo.sp_WeeklyArticle
   IF OBJECT_ID('dbo.sp_WeeklyArticle') IS NULL
      PRINT 'DROPPED PROCEDURE dbo.sp_WeeklyArticle'
   ELSE
      PRINT 'FAILED DROPPING PROCEDURE dbo.sp_WeeklyArticle'
END
GO

CREATE PROCEDURE dbo.sp_WeeklyArticle @NoofArticle   int

/*****************************************************************/
/* SOW Version 1.0.x                                             */
/*                                                               */
/* Copyright @2005 Spring of Water.      			 */
/*                                                               */
/* 03/17/2005                                                    */
/*                                                               */
/*  The sp performs the following functionality. 		 */
/*  Display this week's articles                                 */
/*  								 */
/*                                                               */
/* ============================================================= */
/* Modification History                                          */
/* ============================================================= */
/* Date:      Developer:       Comment:                          */
/* -----      ----------       --------                          */
/*****************************************************************/
AS
    Declare @SQLstring  VarChar(1000)

    Select @SQLstring = 'SELECT TOP ' + CAST(@NoofArticle AS VARCHAR(10))  + ' * FROM Word ORDER BY Rating DESC'

    Exec (@SQLstring)
GO

